package com.jrx.anytxn.transaction.job.delaysms.step;

import com.jrx.anytxn.customer.entity.TlDelaySms;
import com.jrx.anytxn.customer.mapper.ext.ExtTlDelaySmsMapper;
import com.jrx.anytxn.transaction.constant.TransBizConstant;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DelaySmsSendWriter implements ItemWriter<TlDelaySms> {

    @Autowired
    private ExtTlDelaySmsMapper extTlDelaySmsMapper;

    @Override
    public void write(List<? extends TlDelaySms> list){
        for (TlDelaySms tlDelaySms : list) {
            TlDelaySms updateDelaySms = new TlDelaySms();
            updateDelaySms.setId(tlDelaySms.getId());
            updateDelaySms.setDealStatus(TransBizConstant.SMS_SEND_STATUS_SUC);
            extTlDelaySmsMapper.updateByIdForBatch(updateDelaySms);
        }
    }
}
